
import {getdev,querydev} from  "@/api/zhu/index.js"


const state={
  loading:false,
  total:1,
postlist:[
{id:9},
],
ids:[]
}
const mutations={
geng(state,newlist){
      state.postlist=newlist;
      // console.log(state.postlist);
      
},
hhh(state,neli){
state.ids=neli
},
logge(state,form){
state.loading=false;
state.total=form.totalSize
}
}
const actions={
  toglist({ commit },form) {
    return new Promise((resolve, reject)=>{
      getdev(form).then((res)=>{
        commit('geng',res.element.content);
        commit('logge',res.element)
        resolve(res);
        
      })
    })
  },
  togquery({commit},form){
    return new Promise((reso,rej)=>{
      querydev(form).then(res=>{
        commit('geng',[res.element]);
        commit('logge',{totalSize:1});
        reso(res)
      })
    })
  }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
  }